/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <cassert>
#include <fcntl.h>
#include <gtest/gtest.h>
#include <singleton.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string>
#include "file_share.h"

namespace {
    using namespace std;
    using namespace OHOS::AppFileService::ModuleFileShare;

    const int E_OK = 0;

    class FileShareTest : public testing::Test {
    public:
        static void SetUpTestCase(void) {};
        static void TearDownTestCase() {};
        void SetUp() {};
        void TearDown() {};
    };

    /**
     * @tc.name: file_share_test_0000
     * @tc.desc: Test function of FileShare() interface for SUCCESS.
     * @tc.size: MEDIUM
     * @tc.type: FUNC
     * @tc.level Level 1
     * @tc.require: SR000H63TL
     */
    HWTEST_F(FileShareTest, file_share_FileShare_0000, testing::ext::TestSize.Level1)
    {
        string uri = "file://com.example.demoa/data/storage/el2/base/files/1.txt";
        unsigned int tokenID = 100;
        int flag = 1;
        int ret = FileShare::CreateShareFile(uri, tokenID, flag);
        EXPECT_EQ(ret, E_OK);
        ret = FileShare::DeleteShareFile(uri, tokenID, flag);
        EXPECT_EQ(ret, E_OK);
    }
}